# class Car:
#     def __init__(self, brand, model, color, price, manufacture_date, engine_type):
#         self.brand = brand
#         self.model = model
#         self.color = color
#         self.price = price
#         self.manufacture_date = manufacture_date
#         self.engine_type = engine_type
#         self.is_started = False
#     def start(self):
#         if not self.is_started:
#             print(f"启动{self.color}色的{self.brand} {self.model}。嗡嗡嗡，启动成功！")
#             self.is_started = True
#         else:
#             print("汽车已经启动了。")
#
#     def stop(self):
#         if self.is_started:
#             print(f"停止{self.color}色的{self.brand} {self.model}。")
#             self.is_started = False
#         else:
#             print("汽车已经停止了。")
# class User:
#     def __init__(self, name, budget, driving_experience):
#         self.name = name
#         self.budget = budget
#         self.driving_experience = driving_experience
#         self.owned_cars = []
#     def buy_car(self, car):
#         if self.budget >= car.price:
#             self.owned_cars.append(car)
#             self.budget -= car.price
#             print(f"{self.name}购买了一辆{car.color}色的{car.brand} {car.model}。开心上路吧！")
#         else:
#             print(f"抱歉，{self.name}，您无法购买{car.color}色的{car.brand} {car.model}。")
#     def sell_car(self, car):
#         if car in self.owned_cars:
#             self.owned_cars.remove(car)
#             self.budget += car.price
#             print(f"{self.name}卖掉了一辆{car.color}色的{car.brand} {car.model}。祝您一路顺风！")
#         else:
#             print(f"您没有{car.color}色的{car.brand} {car.model}可以出售。")
# if __name__ == "__main__":
#     # 创建一个用户
#     user = User("小强", 30000, 3)  # 假设小强有3年驾驶经验
#     # 创建一辆汽车
#     car1 = Car("小米", "Mi 1", "红", 25000, "2023-01-15", "电动")
#     car2 = Car("小米", "Mi 2", "蓝", 35000, "2023-06-20", "混合动力")
#     # 小强购买一辆汽车
#     user.buy_car(car1)
#     # 小强尝试启动汽车
#     car1.start()
#     # 小强再次尝试购买一辆汽车
#     user.buy_car(car2)
#     # 小强出售汽车
#     user.sell_car(car1)
#


# import os
# class FileManager:
#     def create_file(self, filename, content=""):
#         with open(filename, 'w') as file:
#             file.write(content)
#         print(f"已创建文件：{filename}")
#     def create_folder(self, foldername):
#         os.makedirs(foldername)
#         print(f"已创建文件夹：{foldername}")
#     def delete_file(self, filename):
#         if os.path.exists(filename):
#             os.remove(filename)
#             print(f"已删除文件：{filename}")
#         else:
#             print(f"文件不存在：{filename}")
#     def delete_folder(self, foldername):
#         if os.path.exists(foldername):
#             os.rmdir(foldername)
#             print(f"已删除文件夹：{foldername}")
#         else:
#             print(f"文件夹不存在：{foldername}")
#     def rename_file(self, old_filename, new_filename):
#         if os.path.exists(old_filename):
#             os.rename(old_filename, new_filename)
#             print(f"已将文件 {old_filename} 重命名为 {new_filename}")
#         else:
#             print(f"文件不存在：{old_filename}")
#     def rename_folder(self, old_foldername, new_foldername):
#         if os.path.exists(old_foldername):
#             os.rename(old_foldername, new_foldername)
#             print(f"已将文件夹 {old_foldername} 重命名为 {new_foldername}")
#         else:
#             print(f"文件夹不存在：{old_foldername}")
#     def list_files(self, foldername="."):
#         files = os.listdir(foldername)
#         print(f"文件夹 {foldername} 中的文件：")
#         for file in files:
#             print(file)
#     def search_file(self, filename, foldername="."):
#         for root, dirs, files in os.walk(foldername):
#             if filename in files:
#                 print(f"在文件夹 {root} 中找到文件：{filename}")
#                 return os.path.join(root, filename)
#         print(f"文件 {filename} 未找到。")
#         return None
# if __name__ == "__main__":
#     # 创建文件管理器实例
#     file_manager = FileManager()
#     # 创建文件
#     file_manager.create_file("example.txt", "这是一个示例文件内容。")
#     # 创建文件夹
#     file_manager.create_folder("example_folder")
#     # 重命名文件
#     file_manager.rename_file("example.txt", "new_example.txt")
#     # 重命名文件夹
#     file_manager.rename_folder("example_folder", "new_example_folder")
#     # 列出文件
#     file_manager.list_files()
#     # 搜索文件
#     file_manager.search_file("new_example.txt")
#     #删除文件
#     file_manager.delete_file("new_example.txt")
#     # 删除文件夹
#     file_manager.delete_folder("new_example_folder")
#
#
#
